Week3:hw3 判斷質數


Posted by rockyooooooo on 2021-04-19

這一題要先找出數字的所有因數,所以直接用上一周 hw4:印出因數的 code 來改寫
因為質數只會有兩個因數, 1 跟自己
唯一的例外數字 1,既不是合數也不是因數,按題目要求,視為合數處理

  1. 先把所有因數都存在一個 array
  2. array 的長度就是因數的個數









Related Posts

如何使用 Google Cartographer SLAM 演算法來建地圖

如何使用 Google Cartographer SLAM 演算法來建地圖

763. Partition Labels

763. Partition Labels

使用 node.js 寫出串接 API 的程式

使用 node.js 寫出串接 API 的程式


Comments